<?php

namespace app\merchant\service;

use app\Response;
use app\siteadmin\model\Address;

class MerchantService
{
    /*** 商家地址列表查询
     */
    public static function merchantAddListService($m_id,$page,$num){
        if(empty($m_id)){
            return Response::wrapError(0,"参数异常！");
        }
        $where[] = ["uid","=",$m_id];
        $list = Address::datalist($where,$page,$num);
        if(!empty($list)){
            $data = $list->toArray();
            foreach ($data as $k => $v){
                $data[$k]["addtime"] = !empty($v["addtime"])?date("Y-m-d H:i:s",$v["addtime"]):"";
            }
            $count = Address::listCount($where);
        }else{
            $data = [];
            $count = 0;
        }
        return Response::wrapData($data,$count);
    }
}